<style>
.feedisplay
{
	font-size:10px;
	font-weight:bold;
}
</style>
<!-- Jquery -->
<script type="text/javascript" src="scripts/jquery/jquery.js"></script>
<script type="text/javascript" src="scripts/jquery/jqueryui.js"></script>		

<div class="feedisplay">
<?
	function microtime_float() 
	{ 

	}
		
	# Globals
	include "../includes/defines_global.php";
	include "../includes/defines_user.php";
	include "../includes/defines_tables.php";
	
	# Connection
	include "../classes/pdo.php";
	$DB = new Database(DB_DATABASE, DB_TABLE, DB_USER, DB_PASS);
	
	# Functions
	include "../includes/functions.php";

	# Limits
	$TimeLimitInHours = 0.5;
	$UnixTimeLimit = time() - (60*60*$TimeLimitInHours);
	
	# _GETS
	$CICUID = $_GET['id'];
	$FriendsList = $_GET['fl'];
	
	if (empty($CICUID))
	{
		echo '<span class="loadingfeed"><img src="images/loading.gif" style="margin:0 4px -2px 0;" />Loading Feed</span>';
	}
	else
	{
		$FriendsList = explode(",", $FriendsList);
		
		$FriendsListquery = array(TBL_CHARACTERS_CICUID ."IN (". implode(", ", $FriendsList).")");
		
		$JustUpdated = $DB->GetData(TBL_CHARACTERS, "*", true, $FriendsListquery);
		$SortedList = array();
		if ($JustUpdated[0])
		{
			foreach($JustUpdated[3] as $FeedFriend)
				if ($FeedFriend[TBL_CHARACTERS_LASTUPDATED] > $UnixTimeLimit)
					$SortedList[] = $FeedFriend;
			
			$MaxNum = count($SortedList);
			$Num = mt_rand(0, $MaxNum-1);
			$Data = $SortedList[$Num];
			
			echo '<div style="font-size:10px;margin-top:-2px; display:none;" id="feedbox">';
			echo '<div>
				  <img src="'. $Data[TBL_CHARACTERS_AVATAR] .'" id="avatar"  width="18" height="18" style="opacity:0;margin-bottom:-5px;" />
				  <a href="?'. $Data[TBL_CHARACTERS_CICUID] .'">'. $Data[TBL_CHARACTERS_NAME] .'</a>
				  <span style="font-weight:normal;">recently updated.</span> '. TranslateTime($Data[TBL_CHARACTERS_LASTUPDATED]) .'</div>';
			echo '</div>';

		}
		
		?>
		<script>
		function Go()
		{
			$('#feedbox').show( "slide", { direction: "up" }, 300 );
			setTimeout("showAvatar()", 400);
			//setTimeout("FadeOut()", 4000);
		}
		function showAvatar()
		{
			$('#avatar').animate({ 'opacity': '1' }, 300);
		}
		function FadeOut()
		{
			$('#avatar').animate({ 'opacity': '0' }, 300);
			setTimeout("SlideOut()", 400);	
		}
		function SlideOut()
		{
			$('#feedbox').hide( "slide", { direction: "up" }, 300 );
		}
		Go();
		</script>
		<?
	}
?>
</div>